# coding:utf-8

def DivideSearch(num,list):
    low = 0
    high = len(list) - 1

    while low <= high:
        mid = (low + high) / 2
        guess = list[mid]
        if guess == num:
            return mid
        if guess > num:
            high = mid -1  # TODO, +1, -1 的问题
        if guess < num:
            low = mid +1
    return None

list = [1,2,3,4,5,6,7,8,9,10,11,12]

print DivideSearch(6,list)



